package com.xuhai.blog.admin.controller;

import com.xuhai.blog.admin.entity.WebsiteEntity;
import com.xuhai.blog.admin.service.WebsiteService;
import com.xuhai.blog.common.util.ResultJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 网站信息表 前端控制器
 * </p>
 *
 * @author 机蜂
 * @since 2022-02-08
 */
@RestController
@RequestMapping("/admin/website")
public class WebsiteController {

    @Autowired
    private WebsiteService websiteService;

    @GetMapping("/info")
    public ResultJson info(){
        return ResultJson.ok().data(websiteService.getById(1));
    }

    @PostMapping("/update")
    public ResultJson update(@RequestBody WebsiteEntity website){
        websiteService.saveOrUpdate(website);
        return ResultJson.ok();
    }
}

